<?php

/**
 * noticia form.
 *
 * @package    istmo
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class noticiaForm extends BasenoticiaForm {

    public function configure() {

        $this->widgetSchema['detalle'] = new sfWidgetFormTextarea(array(
            
        ), array('class' => "backtext_area"));

        $years = range(2014, 2024);
        $this->widgetSchema['fecha'] = new sfWidgetFormI18nDate(array(
            'culture' => 'es',
            'month_format' => 'name',
            'years' => array_combine($years, $years)
        ));
        
      /*  $this->widgetSchema['fecha']
         ->setOption('date', array('format' => '%day% %month% %year%'));*/
         
         $this->widgetSchema['fecha']->setOption('default', time());
        
        $imagen = '/uploads/contenidos/noticia/' . $this->getObject()->imagen;
        
        $this->widgetSchema['imagen'] = new sfWidgetFormInputFileEditable(array(
            'label' => 'Imagen para el banner',
            'file_src' => $imagen,
            'is_image' => true,
            'edit_mode' => !$this->isNew(),
            'template' => '<style>.fix img{max-width:200px; display:block;}</style><div class="fix">%file%</div><br />%input%<br />',
            'delete_label' => 'Borrar imagen'));

        $this->validatorSchema['imagen'] = new sfValidatorFile(array(
            'required' => $this->isNew(),
            'path' => sfConfig::get('sf_upload_dir') . '/contenidos/noticia/',
            'mime_types' => 'web_images',
        ));
        
         $this->widgetSchema->setLabels(array(
      'intro'  => 'Título de la noticia'
    ));
        
    unset($this['noticiacol']);
    }

}
